Visual Basic "Gauge" Code Module
V1.00



Important Notes


Usage

VB Gauge is a code module containing a subroutine that will draw a basic
"VUMeter" type gauge on a specified picture box.  There are no numbers, lines,
or bells or other whistles.  It just draws a gauge and a indicator needle.
This code will work with Visual Basic 3.0.  It should work with Visual Basic
4.0 also, and maybe even Visual Basic 2.0, if anyone is still using it.

WHY CODE?

Native code does not use up as much system resources as a VBX.  It is much
smaller, and can be integrated into a program.  It can also be modified
by the user to fit their needs.  It is also smaller.  This documentation
file is bigger than the code.

This text file describes the working of the meter AS SUPPLIED.  You can modify
it, and none of this will matter.  I DON'T CARE WHAT YOU DO WITH IT.  I don't
want any money, or credit, or e-mail.  If it does what you need it to do,
then congratulations.  If it doesn't, delete it or modify it.


DISCLAIMER

The "GAUGE" Visual Basic code module is distributed AS IS.  The author hereby
releases the code and documentation into the public domain.  

The author retains or reserves no rights to the code as specified, and will
not be responsible for anything it does to your computer, or someone else's
computer, or what you do with it.  If the module goes berzerk and does bad
things to someone else's computer, the whole world is going to laugh at you
and YOU are going to be sued, NOT ME.  That is NOT GOING to happen, but just
in case, you would do well to throw in a disclaimer in anything you
distribute.  I make no guarantees.


Operation

VB Gauge is a SUB in a code module.  You must add it to your current project
before you can use it.  If you don't know how to do that, you do not have any
business programming in BASIC.  Think of it as a DLL you don't have to
declare.

Sub Gauge (Object As Control, CX As Integer, CY As Integer, Value As Single,
           NeedleClr As Long, BackClr As Long, ForeClr As Long)

        Object: The name of the picture box that you want to draw a gauge
                on.  I have not tested this on other controls, so I don't
                know if it will only support picture boxes.

        CX:     This is the X-Coordinate, IN PIXELS, of the center of the
                top arc of the gauge.  You might have to experiment to get
                the desired position.

        CY:     This is the (You guessed it!) Y-Coordinate, IN PIXELS.

        Value:  This is a single precision number ranging from 0 to 1
                representing the value the indicator should show.
                Example:

                Let us say you want to indicate the number 8, with the min
                being 0 and the max being 20.  You would want the percentage
                8 is of 20.  You would pass this as VALUE:

                        Value = (8 / 20)

                Simple enough...

        NeedleClr: This is a LONG integer indicating a RGB color for the
                   indicator needle.

        BackClr: This is a LONG integer indicating a RGB color for the face
                 of the gauge.

        ForeClr: This is a LONG integer indicating a RGB color for the outline
                 of the gauge, and the outline of the needle.

An Example Call:

Gauge Picture1, 200, 200, .66667, RGB(255, 0, 0), RGB(255, 255, 255), 0

As you might guess, RGB(255, 0, 0) is red, RGB(255, 255, 255) is white, and
0 is black.  Figure out the rest.

A call to GAUGE will modify the ScaleMode property of the Picture Box it
draws to.  It may also change some color properties of the Picture Box.


Issues

As written, GAUGE does not draw directly on a form.  A resourceful programmer
could deal with this, but I leave that to your imagination.

GAUGE draws the entire face upon each call.  It runs somewhat slow, however.
There is a slight speed gain when you compile into an EXE, but you still may
be able to notice the draws if you change the value and redraw.  You might
get a speed increase in Visual Basic 4.0 with 32-bit code, but I don't know.

Since I can't stop you, go ahead and modify this code if you wish.  Even take
the credit if you want.  I want nothing from you in return, no rewards for
my effort.  This was the product of a very late night typing into boredom,
and I see no point in wasting time trying to sell it.  Besides, I have looked
many a time for anything I could use in my programs that I could afford
(i.e. FREE).  Just felt like contributing.

Modifications to the code module are permitted and encouraged.  The author, as
stated, assumes no responsibility for the program distributed as is or as
modified by the user.


Support / Feedback

I will provide e-mail support, just because I am a nice guy.  I will provide
support on the following conditions:

        1.      You haven't modified the code in any way.
        2.      You have read this entire document.
                (I won't ask questions.)

I will also accept feedback about various issues involving the code and
documentation.  Anything you can tell me, like suggestions, comments,
critizisms, questions, or observations, will be most helpful and VERY VERY
appreciated.

My e-mail address:  76345,10 (Compuserve)
         Internet:  76345.10@compuserve.com


                                THE END

